<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>新闻详情</title>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="//cdn.bootcss.com/weui/0.4.3/style/weui.min.css">
		<link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/0.8.3/css/jquery-weui.min.css">
		<link rel="stylesheet" href="../css/index.css" />
		<style>
			p{
				text-indent: inherit !important;
			}
			#img{
				margin-bottom: 10px;
				float: inherit !important;
				margin-bottom: 30px;
			}
			img{
				float: inherit !important;
			}
			#detail b{
				float: inherit; 
			 	display: inherit; 
			 	font-weight: inherit; 
				 margin-top: inherit; 
				color: inherit; 
			}
		</style>
	</head>
	<body id="presslistdetails">
		<!--<h1 id="title"></h1>
		<span><img src="../img/xgz.png"/><span id="collNum"></span></span>
		<b id="updateTime"></b>
		<section>
			<img id="img" src="" />
			<div id="detail">
				
			</div>
		</section>-->
		<script src="//cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
		<script src="//cdn.bootcss.com/jquery-weui/0.8.3/js/jquery-weui.min.js"></script>
		<script type="text/javascript" src="../js/basic.js" ></script>
		<script>
			var ip_addr = getUrl();
			$(document).ready(function() {
				newsdetail();
			});
			//新闻详情接口
			function newsdetail() {
				var id = GetQueryString("id");
				document.getElementById("presslistdetails").innerHTML = "";
				$.ajax({
					type: 'post',
					dataType: "json",
					url: ip_addr + 'news/detail',
					data: {
						id: id,
					},
					success: function(data) {
						var result = data.data;
						var innerHTML = '';
						if(data.code == 0) {
						 	innerHTML +='<h1 id="title">'+result.title+'</h1>';
							innerHTML +='<span>';
							
//							if(result.iscollect == 0){
//								innerHTML +='<a onclick="newsgive('+result.id+')" href="javascript:;">';
//								innerHTML +='<img src="../img/mgz.png"/>';
//								innerHTML +='</a>';
//							}else{
//								innerHTML +='<a onclick="newsclean('+result.id+')" href="javascript:;">';
//								innerHTML +='<img src="../img/xgz.png"/>';
//								innerHTML +='</a>';
//							}
//							innerHTML +='<span id="collNum">'+result.collNum+'</span></span>';
							innerHTML +='<b id="updateTime">'+formatDateM(result.updateTime)+'</b>';
							innerHTML +='<section>';
							innerHTML +='<img id="img" src="'+result.img.replace('../',"")+'" />';
							
							var detail = result.detail.replace('../',"");
							innerHTML +='<div id="detail">'+detail+'</div>';
							innerHTML +='</section>';
							
							$("#presslistdetails").append(innerHTML);
							
						} else {
							$.alert({
							  title: '温馨提示',
							  text: '很抱歉，您还未登录，请登录!',
							  onOK: function () {
							   window.location.href = 'wode.html?type=1';
							  }
							});
						}
					}
				});
			}
			
//			//收藏接口
//			function newsgive(id) {
//				$.ajax({
//					type: 'post',
//					dataType: "json",
//					url: ip_addr + 'news/give',
//					data: {
//						id: id,
//					},
//					success: function(data) {
//						if(data.code == 0) {
//							newsdetail()
//						} else {
//							alert(data.msg);
//						}
//					}
//				});
//			}
//			//取消收藏接口
//			function newsclean(id) {
//				$.ajax({
//					type: 'post',
//					dataType: "json",
//					url: ip_addr + 'news/clean',
//					data: {
//						id: id,
//					},
//					success: function(data) {
//						if(data.code == 0) {
//							newsdetail()
//						} else {
//							alert(data.msg);
//						}
//					}
//				});
//			}	
		</script>
	</body>
</html>
